//package com.pucheng.bracelet.ui.activity.watch
//
//import android.os.Bundle
//import android.view.View
//import androidx.core.view.isVisible
//import androidx.lifecycle.observe
//import androidx.recyclerview.widget.LinearLayoutManager
//import com.pucheng.bracelet.R
//import com.pucheng.bracelet.app.ext.KEY_WATCH_INFO
//import com.pucheng.bracelet.app.util.click
//import com.pucheng.bracelet.databinding.ActivityWatchEditBinding
//import com.pucheng.bracelet.ui.adapter.*
//import com.pucheng.bracelet.viewmodel.bracelet.WatchViewModel
//import me.hgj.jetpackmvvm.base.activity.BaseVmDbActivity
//
//class WatchEditActivity : BaseVmDbActivity<WatchViewModel, ActivityWatchEditBinding>() {
//    private var watchData: WatchData? = null
//    private val mAdapter = ColorAdapter { index: Int, _: ColorData ->
//        mViewModel.selectColorData(index)
//    }
//    private val mTimeAdapter = TextAdapter { index: Int, textData: TextData ->
//        mDatabind.tvTime.text = textData.text
//        mViewModel.selectTimeData(index)
//    }
//    private val mTimeUpAdapter = TextAdapter { index: Int, textData: TextData ->
//        mDatabind.tvTimeUp.text = textData.text
//        mViewModel.selectTimeUpData(index)
//    }
//    private val mTimeDownAdapter = TextAdapter { index: Int, textData: TextData ->
//        mDatabind.tvTimeDown.text = textData.text
//        mViewModel.selectTimeDownData(index)
//    }
//
//    override fun layoutId(): Int = R.layout.activity_watch_edit
//    override fun initView(savedInstanceState: Bundle?) {
//        watchData = intent.getSerializableExtra(KEY_WATCH_INFO) as? WatchData
//        mDatabind.apply {
//            watchData?.apply {
//                mViewModel.editWatchData.value = this
//            }
//            viewModel = mViewModel
//            lifecycleOwner = this@WatchEditActivity
//            rvTextColor.apply {
//                adapter = mAdapter
//                layoutManager = LinearLayoutManager(
//                    this@WatchEditActivity,
//                    LinearLayoutManager.HORIZONTAL,
//                    false
//                )
//            }
//            rvTime.apply {
//                adapter = mTimeAdapter
//                layoutManager = LinearLayoutManager(
//                    this@WatchEditActivity,
//                    LinearLayoutManager.HORIZONTAL,
//                    false
//                )
//            }
//            rvTimeUp.apply {
//                adapter = mTimeUpAdapter
//                layoutManager = LinearLayoutManager(
//                    this@WatchEditActivity,
//                    LinearLayoutManager.HORIZONTAL,
//                    false
//                )
//            }
//            rvTimeDown.apply {
//                adapter = mTimeDownAdapter
//                layoutManager = LinearLayoutManager(
//                    this@WatchEditActivity,
//                    LinearLayoutManager.HORIZONTAL,
//                    false
//                )
//            }
//            tvCancel.click {
//                finish()
//            }
//            tvSave.click {
//                mViewModel.saveWatch()
//                finish()
//            }
//            tvSelectPic.click {
//
//            }
//            tvSelectDefault.click {
//
//            }
//            tvTime.click {
//                tvTimeArrow.setImageDrawable(resources.getDrawable(R.mipmap.down_step_gray))
//                rvTime.apply {
//                    visibility=if (isVisible)  View.GONE else View.VISIBLE
//                }
//            }
//            tvTimeUp.click {
//                tvTimeUpArrow.setImageDrawable(resources.getDrawable(R.mipmap.down_step_gray))
//                rvTimeUp.apply {
//                    visibility=if (isVisible)  View.GONE else View.VISIBLE
//                }
//            }
//            tvTimeDown.click {
//                tvTimeDownArrow.setImageDrawable(resources.getDrawable(R.mipmap.down_step_gray))
//                rvTimeDown.apply {
//                    visibility=if (isVisible)  View.GONE else View.VISIBLE
//                }
//            }
//        }
//
//        mViewModel.apply {
//            colorData.observe(this@WatchEditActivity) {
//                mAdapter.submitList(it)
//            }
//            timeData.observe(this@WatchEditActivity) {
//                mTimeAdapter.submitList(it)
//            }
//            timeUpData.observe(this@WatchEditActivity) {
//                mTimeUpAdapter.submitList(it)
//            }
//            timeDownData.observe(this@WatchEditActivity) {
//                mTimeDownAdapter.submitList(it)
//            }
//        }
//    }
//
//    override fun createObserver() {
//
//    }
//
//    override fun dismissLoading() {
//    }
//
//    override fun showLoading(message: String) {
//    }
//}